<?php
namespace app\index\controller;

use app\index\model\Jianlis;
use app\index\model\Jianlisqz;
use think\Db;
use app\common\controller\IndexBase;

class Jianli extends IndexBase
{
    /**
     * 简历列表
     */
    public function lists()
    {
        $jianlis = new Jianlis();
        $jianlisqz = new Jianlisqz();
        $list_qz = $jianlisqz->where(['openid'=>session('wx')])->field('id,jname,add_time,update_time')->order('update_time desc,add_time desc')->select();
        $list = $jianlis->where(['openid'=>session('wx')])->field('id,jname,add_time,update_time')->order('update_time desc,add_time desc')->select();
        return $this->fetch('lists',['list'=>$list,'list_qz'=>$list_qz]);
    }
    public function jianli_list()
    {   
        $openid = session('wx');
        $res_index = model('job')->where(['is_index'=>1,'is_show'=>1])->field('jobid,cid,jobname,wage,city,is_index,update_time,reading')->order('is_index desc,sort desc,update_time desc,add_time desc,jobid desc')->order('update_time desc,add_time desc')->limit(1)->select();

        $res = db('jianlis')->where('openid',$openid)->field('id,name,add_time,update_time,wzd')->order('id desc,add_time desc,update_time desc')->select();
        return $this->fetch('jianli_list',['list'=>$res,'job_index'=>$res_index]);
    }
    public function index()
    {   
        $openid = session('wx');
        $res = db('jianlis')
           ->where('openid',$openid)
		   ->order('id desc')
           ->find();
        if ($res) {
            $res['shixi_start1'] = json_decode($res['shixi_start1'],true);
            $res['shixi_end1'] = json_decode($res['shixi_end1'],true);
            $res['shixi_start2'] = json_decode($res['shixi_start2'],true);
            $res['shixi_end2'] = json_decode($res['shixi_end2'],true);
            $res['shixi_company'] = json_decode($res['shixi_company'],true);
            $res['shixi_zw'] = json_decode($res['shixi_zw'],true);
            $res['shixi_daiyu'] = json_decode($res['shixi_daiyu'],true);
            $this->assign('user_data',$res);
            return $this->fetch('index');
        }else{
            return $this->fetch('index/search_jl');
        }   
    }

    public function edit()
    {
        $gongsixingzhi=array('外资(欧美)','外资(非欧美)','合资','国企','民营公司','上市公司','创业公司','外企代表处','政府机关','事业单位','非营利组织');
        /*$qiwangxinzi=array('2万以下/年','2-3万/年','3-4万/年','4-5万/年','5-6万/年','6-8万/年','8-10万/年','10-15万/年','15-20万/年','20-30万/年','30-40万/年','40-50万/年',
            '50-60万/年','60-80万/年','80-100万/年','一百万以上/年'
        ,'1500以下/月','1500-1999/月','2000-2999/月','3000-4499/月','4500-5999/月','6000-7999/月','8000-9999/月','10000-14999/月','15000-19999/月','20000-29999/月'
        ,'30000-39999/月','40000-49999/月','50000-69999/月','70000-99999/月','100000以上'
        );*/
        $qiwangxinzi=array('1500以下/月','1500-1999/月','2000-2999/月','3000-4499/月','4500-5999/月','6000-7999/月','8000-9999/月','10000-14999/月','15000-19999/月','20000-29999/月'
        ,'30000-39999/月','40000-49999/月','50000-69999/月','70000-99999/月','100000以上/月'
        );
        $gongzuoxingzhi=[
            '全职',
            '全职/兼职'
        ];
        $id = input('id');
        $type = input('type'); //1兼职 2全职

        if ($type==1){
            $jianlis = new Jianlis();
            $res = $jianlis->where(['id'=>$id])->find();
            $res['shixi_start1'] = json_decode($res['shixi_start1'],true);
            $res['shixi_end1'] = json_decode($res['shixi_end1'],true);
            $res['shixi_start2'] = json_decode($res['shixi_start2'],true);
            $res['shixi_end2'] = json_decode($res['shixi_end2'],true);
            $res['shixi_company'] = json_decode($res['shixi_company'],true);
            $res['shixi_zw'] = json_decode($res['shixi_zw'],true);
            $res['shixi_daiyu'] = json_decode($res['shixi_daiyu'],true);
            $this->assign('user_data',$res);
            return $this->fetch('index');
        }else{
            $jianlisqz = new Jianlisqz();
            $res = $jianlisqz->where(['id'=>$id])->find();

            $res['shixi_start1'] = json_decode($res['shixi_start1'],true);
            $res['shixi_end1'] = json_decode($res['shixi_end1'],true);
            $res['shixi_start2'] = json_decode($res['shixi_start2'],true);
            $res['shixi_end2'] = json_decode($res['shixi_end2'],true);
            $res['shixi_company'] = json_decode($res['shixi_company'],true);
            $res['shixi_companyhangye'] = json_decode($res['shixi_companyhangye'],true);
            $res['shixi_bm'] = json_decode($res['shixi_bm'],true);
            $res['shixi_zw'] = json_decode($res['shixi_zw'],true);
            $res['shixi_daiyu'] = json_decode($res['shixi_daiyu'],true);
            $res['shixi_gzmiaoshu'] = json_decode($res['shixi_gzmiaoshu'],true);
            $res['shixi_lizhiyuanyin'] = json_decode($res['shixi_lizhiyuanyin'],true);
            //学习经历
            $res['xuexi_start1'] = json_decode($res['xuexi_start1'],true);
            $res['xuexi_start2'] = json_decode($res['xuexi_start2'],true);
            $res['xuexi_end1'] = json_decode($res['xuexi_end1'],true);
            $res['xuexi_end2'] = json_decode($res['xuexi_end2'],true);
            $res['school_name'] = json_decode($res['school_name'],true);
            $res['school_zhuanye'] = json_decode($res['school_zhuanye'],true);
            $res['school_zz'] = json_decode($res['school_zz'],true);
            $this->assign('user_data',$res);
            return $this->fetch('qz',['gongsixingzhi'=>$gongsixingzhi,'qiwangxinzi'=>$qiwangxinzi,'gongzuoxingzhi'=>$gongzuoxingzhi]);
        }
    }
    public function create()
    {   
        if ($this->request->isPost()) {
            $data = input('post.');
            foreach ($data as $ks => $vs) {
                $data[$ks] = str_replace('&ndash;','-',$data[$ks]);
                $data[$ks] = str_replace('&mdash;','-',$data[$ks]);
                $data[$ks] = str_replace('&middot;','-',$data[$ks]);
                $data[$ks] = str_replace('&tilde;','-',$data[$ks]);  
                $data[$ks] = str_replace('&sbquo;','-',$data[$ks]);
                $data[$ks] = str_replace('&circ;','-',$data[$ks]);     
                $data[$ks] = str_replace('&ldquo;','-',$data[$ks]);
                $data[$ks] = str_replace('&rsquo;','-',$data[$ks]);     
                $data[$ks] = str_replace('&shy;','-',$data[$ks]);
                $data[$ks] = str_replace('&rdquo;','-',$data[$ks]);     
                $data[$ks] = str_replace('&hellip;','-',$data[$ks]);          
            }
            if ($data['__token__'] == session('token') &&  $data['__token__'] != "") {
                echo "<script language='javascript' type='text/javascript'> 
                    alert('不能重复提交');
                    window.location.href = '/index/index/usercenter';
                   </script>"; 
                die;
            }else{
                session('token',$data['__token__']);
            }
            unset($data['__token__']);
            $sub_type = $data['sub_type'];
            unset($data['sub_type']);
            $data['shixi_start1'] = json_encode($_POST['shixi_start1'],JSON_UNESCAPED_UNICODE);
            $data['shixi_start2'] = json_encode($_POST['shixi_start2'],JSON_UNESCAPED_UNICODE);
            $data['shixi_end1'] = json_encode($_POST['shixi_end1'],JSON_UNESCAPED_UNICODE);
            $data['shixi_end2'] = json_encode($_POST['shixi_end2'],JSON_UNESCAPED_UNICODE);
            $data['shixi_company'] = json_encode($_POST['shixi_company'],JSON_UNESCAPED_UNICODE);
            $data['shixi_zw'] = json_encode($_POST['shixi_zw'],JSON_UNESCAPED_UNICODE);
            $data['shixi_daiyu'] = json_encode($_POST['shixi_daiyu'],JSON_UNESCAPED_UNICODE);
            $data['update_time'] = date('Y-m-d H:i:s',time());
            $data['openid'] = session("wx");
            //默认上传图片
            $data['img_url'] = upload_file('img_url','touxiang');
            $id = db('jianlis')->where('openid',session('wx'))->order('id desc')->value('id');
            if ($id) {
                $data['id'] = $id;
                if (empty($data['img_url'])) {
                    unset($data['img_url']);
                }else{
//                    $image = \think\Image::open('./'.$data['img_url']);//原大图路径 ./
//                    $image->thumb(300, 390)->save('./'.$data['img_url'],null,100);

                $newimgname = 'tx_'.substr('.'.$data['img_url'],strripos('.'.$data['img_url'],'/')+1); //新图名称加后缀
                $newimgurl = substr('.'.$data['img_url'],0,strripos('.'.$data['img_url'],'/')+1); //新图url/
                copy(substr($data['img_url'],1),substr($newimgurl,2).$newimgname); //复制原图到新图路径
                resizeImage($newimgurl.$newimgname,300,390); //压缩图片
                $data['img_url'] = substr($newimgurl,1).$newimgname;//新图

                }
                $res = db('jianlis')->update($data);
            }else{
//                $image = \think\Image::open('./'.$data['img_url']);//原大图路径  ./
//                $image->thumb(300, 390)->save('./'.$data['img_url'],null,100);
                //                resizeImage('.'.$data['img_url'],300,390);

                $newimgname = 'tx_'.substr('.'.$data['img_url'],strripos('.'.$data['img_url'],'/')+1); //新图名称加后缀
                $newimgurl = substr('.'.$data['img_url'],0,strripos('.'.$data['img_url'],'/')+1); //新图url/
                copy(substr($data['img_url'],1),substr($newimgurl,2).$newimgname); //复制原图到新图路径
                resizeImage($newimgurl.$newimgname,300,390); //压缩图片
                $data['img_url'] = substr($newimgurl,1).$newimgname;//新图
                $data['add_time'] = date('Y-m-d H:i:s',time());
                $data['update_time'] = date('Y-m-d H:i:s',time());
                unset($data['id']);
                $res =db('jianlis')->insertGetId($data);
                $id = $res;
                //生成专属推荐码
                $str_tuijian = createNonceStr(2).$id.createNonceStr(1);
                db('jianlis')->where(['id'=>$id])->update(['tuijian'=>$str_tuijian]);
            }
            if($res !== false){
                //查看完整度
                $arr = db('jianlis')
                    ->where('id',$id)
                    ->find();
                unset($arr['wzd']);
                $wzd = round(count(array_filter($arr))*0.036*100);
                db('jianlis')->where('id',$id)->update(['wzd'=>$wzd]);
                $title_name = $arr['name'].'__'.$arr['newaddress'];
                $url = $_SERVER['SERVER_NAME'];
                //生成word文档
                if ($arr['sex'] == 0) {
                    $arr['sex'] = '女';
                }else{
                    $arr['sex'] ='男';
                }
                $arr['shixi_start1'] = json_decode($arr['shixi_start1'],true);
                $arr['shixi_end1'] = json_decode($arr['shixi_end1'],true);
                $arr['shixi_start2'] = json_decode($arr['shixi_start2'],true);
                $arr['shixi_end2'] = json_decode($arr['shixi_end2'],true);
                $arr['shixi_company'] = json_decode($arr['shixi_company'],true);
                $arr['shixi_zw'] = json_decode($arr['shixi_zw'],true);
                $arr['shixi_daiyu'] = json_decode($arr['shixi_daiyu'],true);
                foreach ($arr['shixi_start1'] as $k1 => &$v1) {
                    if (!$v1) {
                        $v1 = "2010";
                    }
                }
                foreach ($arr['shixi_end1'] as $k2 => &$v2) {
                    if (!$v2) {
                        $v2 = "2010";
                    }
                }
                foreach ($arr['shixi_start2'] as $k3 => &$v3) {
                    if (!$v3) {
                        $v3 = "01";
                    }
                }
                foreach ($arr['shixi_end2'] as $k4 => &$v4) {
                    if (!$v4) {
                        $v4 = "01";
                    }
                }
                $tuijian = $arr['tuijian'];
                $makeword =  new Makeword();
                $makeword->word($arr);
                //邮件正文
                $body_data = <<<hoa
                    <p>简历请查看附件</p>
                    <p>（这是一封自动发送的邮件，请不要直接回复）</p>
                    <p><br  />
                    </p>
hoa;
                //发送邮件xinlv_zp@hrnew.netlzy@huisheng.com
                if ($sub_type) {
                    $resmess =  send_mail('xinlv_zp@hrnew.net',$title_name,$body_data,$arr['id']);
                    if($resmess !== true){
                        echo "<script language='javascript' type='text/javascript'>
                    alert('".$resmess."');
                   </script>";

                    }

                }
                echo "<script language='javascript' type='text/javascript'>
                    alert('您的申请已被受理，我们会尽快联系您。同时，如您为我们推荐其他侯选人，我们将非常感谢您，在此生成您在我们这里唯一的推荐识别码为".$tuijian."，请务必告知您推荐的侯选人填写此推荐码，我们将为您积分。如您遗忘了您推荐码，您可以在个人中心查询。');
                    window.location.href = '/index/index/usercenter';
                   </script>";

            }else{
                echo "<script language='javascript' type='text/javascript'>location.href='javascript:history.back(-1)';</script>";
            }
        }
        return $this->fetch('index');
    }
    public function qz()
    {
        if ($this->request->isPost()) {
            $data = input('post.');

            foreach ($data as $ks => $vs) {
                $data[$ks] = str_replace('&ndash;','-',$data[$ks]);
                $data[$ks] = str_replace('&mdash;','-',$data[$ks]);
                $data[$ks] = str_replace('&middot;','-',$data[$ks]);
                $data[$ks] = str_replace('&tilde;','-',$data[$ks]);
                $data[$ks] = str_replace('&sbquo;','-',$data[$ks]);
                $data[$ks] = str_replace('&circ;','-',$data[$ks]);
                $data[$ks] = str_replace('&ldquo;','-',$data[$ks]);
                $data[$ks] = str_replace('&rsquo;','-',$data[$ks]);
                $data[$ks] = str_replace('&shy;','-',$data[$ks]);
                $data[$ks] = str_replace('&rdquo;','-',$data[$ks]);
                $data[$ks] = str_replace('&hellip;','-',$data[$ks]);
            }
            if ($data['__token__'] == session('token') &&  $data['__token__'] != "") {
                echo "<script language='javascript' type='text/javascript'> 
                    alert('不能重复提交');
                    window.location.href = '/index/index/usercenter';
                   </script>";
                die;
            }else{
                session('token',$data['__token__']);
            }
            unset($data['__token__']);
            $sub_type = $data['sub_type'];
            unset($data['sub_type']);
            $data['shixi_start1'] = json_encode($_POST['shixi_start1'],JSON_UNESCAPED_UNICODE);
            $data['shixi_start2'] = json_encode($_POST['shixi_start2'],JSON_UNESCAPED_UNICODE);
            $data['shixi_end1'] = json_encode($_POST['shixi_end1'],JSON_UNESCAPED_UNICODE);
            $data['shixi_end2'] = json_encode($_POST['shixi_end2'],JSON_UNESCAPED_UNICODE);
            $data['shixi_company'] = json_encode($_POST['shixi_company'],JSON_UNESCAPED_UNICODE);
            $data['shixi_companyhangye'] = json_encode($_POST['shixi_companyhangye'],JSON_UNESCAPED_UNICODE);
            $data['shixi_bm'] = json_encode($_POST['shixi_bm'],JSON_UNESCAPED_UNICODE);
            $data['shixi_zw'] = json_encode($_POST['shixi_zw'],JSON_UNESCAPED_UNICODE);
            $data['shixi_daiyu'] = json_encode($_POST['shixi_daiyu'],JSON_UNESCAPED_UNICODE);
            $data['shixi_gzmiaoshu'] = json_encode($_POST['shixi_gzmiaoshu'],JSON_UNESCAPED_UNICODE);
            $data['shixi_lizhiyuanyin'] = json_encode($_POST['shixi_lizhiyuanyin'],JSON_UNESCAPED_UNICODE);

            //培训学习经历
            $data['xuexi_start1'] = json_encode($_POST['xuexi_start1'],JSON_UNESCAPED_UNICODE);
            $data['xuexi_start2'] = json_encode($_POST['xuexi_start2'],JSON_UNESCAPED_UNICODE);
            $data['xuexi_end1'] = json_encode($_POST['xuexi_end1'],JSON_UNESCAPED_UNICODE);
            $data['xuexi_end2'] = json_encode($_POST['xuexi_end2'],JSON_UNESCAPED_UNICODE);
            $data['school_name'] = json_encode($_POST['school_name'],JSON_UNESCAPED_UNICODE);
            $data['school_zhuanye'] = json_encode($_POST['school_zhuanye'],JSON_UNESCAPED_UNICODE);
            $data['school_zz'] = json_encode($_POST['school_zz'],JSON_UNESCAPED_UNICODE);


            $data['update_time'] = date('Y-m-d H:i:s',time());
            $data['openid'] = session("wx");
            //默认上传图片
            $data['img_url'] = upload_file('img_url','touxiang');
            $id = db('jianlisqz')->where('openid',session('wx'))->order('id desc')->value('id');
            if ($id) {
                $data['id'] = $id;
                if (empty($data['img_url'])) {
                    unset($data['img_url']);
                }else{
                    $image = \think\Image::open('./'.$data['img_url']);//原大图路径 ./
                    $image->thumb(300, 390)->save('./'.$data['img_url']);
                }
                $res = model('jianlisqz')->update($data);
            }else{
                $image = \think\Image::open('./'.$data['img_url']);//原大图路径  ./
                $image->thumb(300, 390)->save('./'.$data['img_url']);
                $data['add_time'] = date('Y-m-d H:i:s',time());
                $data['update_time'] = date('Y-m-d H:i:s',time());
                unset($data['id']);
                $res =db('jianlisqz')->insertGetId($data);
                $id = $res;
                //生成专属推荐码
                $str_tuijian = createNonceStr(2).$id.createNonceStr(1);
                db('jianlisqz')->where(['id'=>$id])->update(['tuijian'=>$str_tuijian]);
            }
            if($res !== false){
                //查看完整度
                $arr = db('jianlisqz')
                    ->where('id',$id)
                    ->find();
                unset($arr['wzd']);
                $wzd = round(count(array_filter($arr))*0.036*100);
                db('jianlisqz')->where('id',$id)->update(['wzd'=>$wzd]);
                $title_name = $arr['name'].'__'.$arr['newaddress'];
                $url = $_SERVER['SERVER_NAME'];
                //生成word文档
                if ($arr['sex'] == 0) {
                    $arr['sex'] = '女';
                }else{
                    $arr['sex'] ='男';
                }


                $arr['shixi_start1'] = json_decode($arr['shixi_start1'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_start2'] = json_decode($arr['shixi_start2'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_end1'] = json_decode($arr['shixi_end1'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_end2'] = json_decode($arr['shixi_end2'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_company'] = json_decode($arr['shixi_company'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_companyhangye'] = json_decode($arr['shixi_companyhangye'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_bm'] = json_decode($arr['shixi_bm'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_zw'] = json_decode($arr['shixi_zw'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_daiyu'] = json_decode($arr['shixi_daiyu'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_gzmiaoshu'] = json_decode($arr['shixi_gzmiaoshu'],JSON_UNESCAPED_UNICODE);
                $arr['shixi_lizhiyuanyin'] = json_decode($arr['shixi_lizhiyuanyin'],JSON_UNESCAPED_UNICODE);

                //培训学习经历
                $arr['xuexi_start1'] = json_decode($arr['xuexi_start1'],JSON_UNESCAPED_UNICODE);
                $arr['xuexi_start2'] = json_decode($arr['xuexi_start2'],JSON_UNESCAPED_UNICODE);
                $arr['xuexi_end1'] = json_decode($arr['xuexi_end1'],JSON_UNESCAPED_UNICODE);
                $arr['xuexi_end2'] = json_decode($arr['xuexi_end2'],JSON_UNESCAPED_UNICODE);
                $arr['school_name'] = json_decode($arr['school_name'],JSON_UNESCAPED_UNICODE);
                $arr['school_zhuanye'] = json_decode($arr['school_zhuanye'],JSON_UNESCAPED_UNICODE);
                $arr['school_zz'] = json_decode($arr['school_zz'],JSON_UNESCAPED_UNICODE);

                foreach ($arr['shixi_start1'] as $k1 => &$v1) {
                    if (!$v1) {
                        $v1 = "2010";
                    }
                }
                foreach ($arr['shixi_end1'] as $k2 => &$v2) {
                    if (!$v2) {
                        $v2 = "2010";
                    }
                }
                foreach ($arr['shixi_start2'] as $k3 => &$v3) {
                    if (!$v3) {
                        $v3 = "01";
                    }
                }
                foreach ($arr['shixi_end2'] as $k4 => &$v4) {
                    if (!$v4) {
                        $v4 = "01";
                    }
                }
                $tuijian = $arr['tuijian'];
                $makeword =  new Makeword();
                //$makeword->qz($arr);
                $time=time();
                $makeword->test($arr,$time);

                //邮件正文
                $body_data = <<<hoa
                    <p>简历请查看附件</p>
                    <p>（这是一封自动发送的邮件，请不要直接回复）</p>
                    <p><br  />
                    </p>
hoa;
                //发送邮件xinlv_zp@hrnew.netlzy@huisheng.com
                if ($sub_type) {
                    $resmess =  send_qz_mail('xinlv_zp@hrnew.net',$title_name,$body_data,$time);
                    if(!$resmess){
                        echo "<script language='javascript' type='text/javascript'>
                    alert('".$resmess."');
                   </script>";

                    }

                }
                echo "<script language='javascript' type='text/javascript'>
                    alert('您的申请已被受理，我们会尽快联系您。同时，如您为我们推荐其他侯选人，我们将非常感谢您，在此生成您在我们这里唯一的推荐识别码为".$tuijian."，请务必告知您推荐的侯选人填写此推荐码，我们将为您积分。如您遗忘了您推荐码，您可以在个人中心查询。');
                    window.location.href = '/index/index/usercenter';
                   </script>";

            }else{
                echo "<script language='javascript' type='text/javascript'>location.href='javascript:history.back(-1)';</script>";
            }
        }
        $gongsixingzhi=array('外资(欧美)','外资(非欧美)','合资','国企','民营公司','上市公司','创业公司','外企代表处','政府机关','事业单位','非营利组织');
        /*$qiwangxinzi=array('2万以下/年','2-3万/年','3-4万/年','4-5万/年','5-6万/年','6-8万/年','8-10万/年','10-15万/年','15-20万/年','20-30万/年','30-40万/年','40-50万/年',
            '50-60万/年','60-80万/年','80-100万/年','一百万以上/年'
        ,'1500以下/月','1500-1999/月','2000-2999/月','3000-4499/月','4500-5999/月','6000-7999/月','8000-9999/月','10000-14999/月','15000-19999/月','20000-29999/月'
        ,'30000-39999/月','40000-49999/月','50000-69999/月','70000-99999/月','100000以上'
        );*/
        $qiwangxinzi=array('1500以下/月','1500-1999/月','2000-2999/月','3000-4499/月','4500-5999/月','6000-7999/月','8000-9999/月','10000-14999/月','15000-19999/月','20000-29999/月'
        ,'30000-39999/月','40000-49999/月','50000-69999/月','70000-99999/月','100000以上/月'
        );
        $gongzuoxingzhi=[
            '全职',
            '全职/兼职'
        ];
        $this->assign('gongsixingzhi',$gongsixingzhi);
        $this->assign('qiwangxinzi',$qiwangxinzi);
        $this->assign('gongzuoxingzhi',$gongzuoxingzhi);
        return $this->fetch('qz');
    }
    public function checkotuijian()
    {
        $otuijian = input('post.otuijian');
        if ($otuijian != '0001') {
            $res = db('users')->where('tuijian',$otuijian)->value('openid');
            if ($res && $res != session('wx')) {
                return true;
            }else{
                return false;
            }
        }else{
            return true;
        }
    }
}